<template>
    <div>
        <h3>管理员登录页面</h3>
        <table class="table">
            <tr>
                <td>账户名</td>
                <td><input type="text" v-model="info.name"></td>
            </tr>
            <tr>
                <td>账户名</td>
                <td><input type="password" v-model="info.pwd"></td>
            </tr>
            <tr>
                <td></td>
                <td> <input type="button" value="登录" @click="login"></td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios'
import {ref,reactive,onMounted} from 'vue'
import { useRoute,useRouter } from 'vue-router';
const router = useRouter();
const route = useRoute();
const info:any =reactive({
    name:'',
    pwd:''
})
const login=()=>{
    axios.get('https://localhost:7267/api/Boss/Login',{params:info}).then(res=>{
            if(res.data==-1)
            {
                alert('密码错误');
                return;
            }
            if(res.data==-2)
            {
                alert('账户错误');
                return;
            }
             if(res.data==-3)
            {
                alert('该账户不是管理员');
                return;
            }
            else
            {
                alert('登录成功');
                router.push('/typeadd');
            }

    })
}
</script>

<style scoped>

</style>